let url = require('url');

let obj = url.parse('http://localhost:3000/pinglun?name=%E8%BF%99%E6%9D%A' +
  '1%E9%B1%BC%E6%98%AF%E6%B8%85&message=AqingCyan%E6%9C%89%E7%82%B9%E5%B8%85', true);// true可加可不加,加上后输出的内容更加详细,字符也被相应的转换成对象了
console.log(obj);

// 输出了以下内容:

/*
Url {
  protocol: 'http:',
    slashes: true,
    auth: null,
    host: 'localhost:3000',
    port: '3000',
    hostname: 'localhost',
    hash: null,
    search:
  '?name=%E8%BF%99%E6%9D%A1%E9%B1%BC%E6%98%AF%E6%B8%85&message=AqingCyan%E6%9C%89%E7%82%B9%E5%B8%85',
    query: { name: '这条鱼是清', message: 'AqingCyan有点帅' },
  pathname: '/pinglun',
    path:
  '/pinglun?name=%E8%BF%99%E6%9D%A1%E9%B1%BC%E6%98%AF%E6%B8%85&message=AqingCyan%E6%9C%89%E7%82%B9%E5%B8%85',
    href:
  'http://localhost:3000/pinglun?name=%E8%BF%99%E6%9D%A1%E9%B1%BC%E6%98%AF%E6%B8%85&message=AqingCyan%E6%9C%89%E7%82%B9%E5%B8%85' }
*/

console.log(obj.query); // { name: '这条鱼是清', message: 'AqingCyan有点帅' }
